package net.xju_11_12.advice;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

@Component
@Aspect
@Order(0)
public class AnnoAdvice {

    @Pointcut("execution(* net.xju_11_12.service.impl.*.* (..) )")
    public void pointCut() {

    }

    @Before("pointCut()")
    public void before() {
        System.out.println("before_Anno");
    }

    @After("pointCut()")
    public void after() {
        System.out.println("after_Anno");
    }

    @AfterReturning("pointCut()")
    public void afterReturning() {
        System.out.println("afterReturning_Anno");
    }
    // 环绕通知
    @Around("pointCut()")
    public Object around(ProceedingJoinPoint point) throws Throwable {
        System.out.println("环绕通知之前部分_Anno");
// 调用目标方法
        Object proceed = point.proceed();
        System.out.println("环绕通知之后的部分_Anno");
        return proceed;
    }
}
